<template>
    <div>
        <div @click="xxx">adsfa</div>
        <slider :announcement="announ" :slides="sliders"></slider>
        <booklist :books="lastupdates"
                  heading="最近更新"
                  @haha="xxx"></booklist>

        <booklist :books="recommendeds"
                  heading="编辑推荐"
                  @haha="xxx"></booklist>

    </div>
</template>


<script type="text/ecmascript-6">
    import slider from './slider.vue'
    import booklist from "./list.vue"


    export default{
        components: {slider, booklist}//{slider, booklist}
        ,created(){
            this.$http.get("/data.json").then(
                    res=>{
                        console.log(res);
                        this.lastupdates=res.body.lastupdatebooks;
                        this.recommendeds=res.body.lastupdatebooks;
                        this.announ=res.body.announcement;
                        this.sliders=res.body.slides;
                    }
            )
        }
        ,data(){
         return {
             lastupdates:[],
             recommendeds:[]
             , announ:'',
             sliders: []
         }
        }
        ,methods:{
            xxx(){
                window.alert('hahahhaha');
            }
        }
    }
</script>
